$('button').click(function () {
    $.ajax({
        url: 'http://localhost:80/zbird/php/login.php',
        type: 'get',
        data: {
            username: $('.user').val(),
            password: $('.pwd').val()
        },
        dataType: 'json',
        success: function (res) {
            if ($('.main-msg p input').prop('checked')) {
                setCookie('USR', 1, 7, '/')
            } else {
                setCookie('USR', 1, '/')
            }
            if (res.state === "success") {
                location.assign("./index.html");
            } else {
                $('label').css({
                    'display': 'block'
                })
                $('label').html(res.msg)
            }
        },
        error: function () {
            alert('发送错误')
        }
    })
})